import request from '@/utils/request'
import { login } from './login'

// api地址
const api = {
  order: 'goodCart/getGoodsItemByGoodCart',
  order2: 'goodCart/goodsItemId',
  submit: 'order',
}

// mode: 结算模式 (buyNow立即购买 cart购物车)

// 结算台订单信息
export const order = (mode, param) => {
	let result;
	if(mode==='buyNow'){
		result= request.get(api.order2, { mode, ...param })
	}else{
		result= request.get(api.order, { mode, ...param })
	}
	console.log(result);
	return result
}

// 结算台订单提交
export const submit = (mode, data,orderCartForms,userAddress) => {
  return request.post(api.submit, {orderCartForms,"userAddress": userAddress }, { isPrompt: false,header: {
    'content-type': 'application/json;charset=utf-8'
  } })
}
